<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>开设新班级-班级管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
	<script>
	$(function(){


		$("#btn_save").click(function(){
			$("form").submit();
		});
	})
	</script>
</head>
<body>
	<div class="wrap">
		<!--star left-->
		<div class="column">
			<{include file="left_menu.html"}>
		</div>
		<div id="ContMianBox">
			<!--star子栏目-->
			<div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
			<!--end子栏目-->
			
			<!--end left-->
			<div class="container narrow">
			    <!--star conter-->
			    <div class="cetContent">
						<div class="tit p-lr20">
						    <span><a href="/classes">班级管理</a></span>
							<span class="curr">创建班级</span>
						</div>
					<!--star内容区域-->
					<div class="mainScroll">
					    <div class="mainContainer line-all">
					        <ul class="ui-nav-tab wList33">
					            <li class="js-step-1 active"><a href="javascript:;">1.编辑班级基本信息</a></li>
					            <li class="js-step-2"><a href="javascript:;">2.分配班级学员</a></li>
					        </ul>
					        <div class="tabMainCont">

					            <!--star 编辑基本信息-->
					            <div class="tabItem step-02">

														<form action="/classes/add" method="post" class="layui-form">
															<div class="layui-form-item">
															 <label class="layui-form-label">班级编号：</label>
															 <div class="layui-input-inline">
																 <input type="text" name="class_num" value="<{if isset($class_num)}><{$class_num}><{/if}>" placeholder="请输入班级编号" required  lay-verify="required" autocomplete="off" class="layui-input">
																 <{if isset($class_num_err)}>
																<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
																<span class="tip" style=" padding:2px 5px;"><{$class_num_err}></span>
																<{/if}>
															 </div>
															</div>
														<div class="layui-form-item">
														 <label class="layui-form-label">班级名称：</label>
														 <div class="layui-input-block">
															 <input type="text" name="class_name" style="width: 500px;" value="<{if isset($class_name)}><{$class_name}><{/if}>" placeholder="请输入班级名称" required  lay-verify="required" autocomplete="off" class="layui-input">
															 <{if isset($class_name_err)}>
															<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
															<span class="tip" style=" padding:2px 5px;"><{$class_name_err}></span>
															<{/if}>
														 </div>
														</div>

														<div class="layui-form-item">
													    <label class="layui-form-label">课程：</label>
															<div class="layui-input-inline">
																	<select name="course_cate" style="width: 500px;" lay-filter="course_cate" lay-verify="required">
																	<option value="">请选择课程分类</option>
																	<{foreach from=$course_cate item=item}>
																	<option value="<{$item['id']}>"><{$item['name']}></option>
																	<{/foreach}>
																</select>
													  	</div>
															<div class="layui-input-inline">
																	<select name="course_id" id="course_id" lay-filter="course_id" style="width: 500px;" lay-verify="required">
																	<option value="">请选择课程</option>

																</select>
													  	</div>
													  </div>
														<div class="layui-form-item">
													    <label class="layui-form-label">教室：</label>
															<div class="layui-input-inline">
																	<select name="campus"  style="width: 500px;" lay-filter="campus" lay-verify="required">
																	<option value="">请选择校区</option>
																	<{foreach from=$campus item=item}>
																	<option value="<{$item['id']}>"><{$item['name']}></option>
																	<{/foreach}>
																</select>
													  	</div>

															<div class="layui-input-inline">
																	<select name="classroom" id="classroom" style="width: 500px;" lay-verify="required">
																	<option value="">请选择教室</option>

																</select>
													  	</div>
													  </div>
														<div class="layui-form-item">
													    <label class="layui-form-label">总课时：</label>
													    <div class="layui-input-inline">
													      <input type="number" lay-verify="number" name="class_hour" value="<{if isset($class_hour)}><{$class_hour}><{/if}>" maxlenght="8" required lay-verify="required" placeholder="总课时" autocomplete="off" class="layui-input">
																<{if isset($class_hour_err)}>
																<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
																<span class="tip" style=" padding:2px 5px;"><{$class_hour_err}></span>
																<{/if}>
															</div>
													    <div class="layui-form-mid layui-word-aux">课时</div>
													  </div>
													  <div class="layui-form-item">
													    <label class="layui-form-label">课时时长：</label>
													    <div class="layui-input-inline">
													      <input type="number" lay-verify="number" name="class_hour_time" value="<{if isset($class_hour_time)}><{$class_hour_time}><{/if}>" maxlenght="8" required lay-verify="required" placeholder="总课时" autocomplete="off" class="layui-input">
																<{if isset($class_hour_time_err)}>
																<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
																<span class="tip" style=" padding:2px 5px;"><{$class_hour_time_err}></span>
																<{/if}>
															</div>
													    <div class="layui-form-mid layui-word-aux">分钟</div>
													  </div>
														<div class="layui-form-item">
													    <label class="layui-form-label">开班人数：</label>
													    <div class="layui-input-inline">
													      <input type="number" lay-verify="number" name="student_count" maxlength="3" value="<{if isset($student_count)}><{$student_count}><{/if}>" required lay-verify="required" placeholder="开班人数" autocomplete="off" class="layui-input">
																<{if isset($student_count_err)}>
																<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
																<span class="tip" style=" padding:2px 5px;"><{$student_count_err}></span>
																<{/if}>
															</div>
													    <div class="layui-form-mid layui-word-aux">人</div>

													  </div>
														<div class="layui-form-item">
													    <label class="layui-form-label">主讲老师：</label>
															<div class="layui-input-inline">
																	<select name="lecturer_id"  style="width: 500px;" lay-verify="required">
																	<option value=""></option>
																	<{foreach from=$teachers item=item}>
																	<option value="<{$item['id']}>"><{$item['teacher_name']}></option>
																	<{/foreach}>
																</select>
													  	</div>
													  </div>
														<div class="layui-form-item">
													    <label class="layui-form-label">班主任：</label>
															<div class="layui-input-inline">
																	<select name="manage_teacher_id"  style="width: 500px;" lay-verify="required">
																	<option value=""></option>
																	<{foreach from=$teachers item=item}>
																	<option value="<{$item['id']}>"><{$item['teacher_name']}></option>
																	<{/foreach}>
																</select>
													  	</div>
													  </div>
														<div class="layui-form-item">
															<label class="layui-form-label">课程起始：</label>
															<div class="layui-input-inline">
																<input class="layui-input" name="start_time" required lay-verify="required" placeholder="开始日" id="LAY_demorange_s">
															</div>
															<div class="layui-form-mid">-</div>
															<div class="layui-input-inline">
																<input class="layui-input" name="end_time" required lay-verify="required" placeholder="截止日" id="LAY_demorange_e">
															</div>

														</div>
														<div class="layui-form-item">
														 <label class="layui-form-label">上课规律：</label>
														 <div class="layui-input-block">
															 <input type="text" name="class_time" style="width:500px" value="<{if isset($suitable)}><{$suitable}><{/if}>" placeholder="上课具体时间，如：每周六上午" required  lay-verify="required" autocomplete="off" class="layui-input">
															 <{if isset($class_time_err1)}>
															 <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
															 <span class="tip" style="padding:2px 5px;"><{$class_time_err1}></span>
															 <{/if}>
														 </div>

														</div>
														<div class="layui-form-item layui-form-text">
														 <label class="layui-form-label">班级说明：</label>
														 <div class="layui-input-block">
															 <textarea placeholder="班级说明" style="width:500px"  name="intro" class="layui-textarea"><{if isset($learn_what)}><{$learn_what}><{/if}></textarea>
															 <{if isset($learned_err)}>
															 <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
															 <{$learned_err}>
															 <{/if}>
														 </div>

														</div>

														<d
														<div class="layui-form-item">
														 <div class="layui-input-block">
															 <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
															 <button type="reset" class="layui-btn layui-btn-primary">取消</button>
														 </div>
														</div>


					            </form>
					            </div>
					            <!--end 编辑基本信息-->

					        </div>


					    </div>
					</div>
					</div>
					<!--end内容区域-->

		    <!--end conter-->
		</div>


	</div>
</div>
<{include file="footer.html"}>
<script>
	layui.use(['form','laydate','jquery'], function(){
		var laydate = layui.laydate;
		var form = layui.form(),$ = layui.jquery;

		var start = {
			min: laydate.now(-30)
			,max: laydate.now(+365)
			,istoday: false
			,choose: function(datas){
				end.min = datas; //开始日选好后，重置结束日的最小日期
				end.start = datas //将结束日的初始值设定为开始日
			}
		};

		var end = {
			min: laydate.now()
			,max: laydate.now(+365)
			,istoday: false
			,choose: function(datas){
				start.max = datas; //结束日选好后，重置开始日的最大日期
			}
		};

		document.getElementById('LAY_demorange_s').onclick = function(){
			start.elem = this;
			laydate(start);
		}
		document.getElementById('LAY_demorange_e').onclick = function(){
			end.elem = this
			laydate(end);
		}

		//课程分类
		form.on('select(course_cate)', function(data){
			var ii = layer.load();
			var cate_id = data.value;
			$("#course_id").html('<option value="">请选择课程</option>');
			form.render('select');
			$.ajax({
				type: "POST",
				url: "/classes/get_offline_course_by_cate/"+cate_id,
				dataType:"json",
				success: function(result){
					var html ='';
					$.each(result, function(i, obj) {
						html += '<option value="'+obj.id+'">'+obj.title+'</option>';
					});
					$("#course_id").append(html);
					form.render('select');
					layer.close(ii);
				}
			});
		});

		//课程
		form.on('select(course_id)',function(data){
			var class_name = $(data.elem).find("option:selected").text();
			$("input[name=class_name]").val(class_name+'<{$year_name}>'+'-<{$class_count}>班');


		});
		//校区
		form.on('select(campus)',function(data){
			var ii = layer.load();
			var campus_id = data.value;
			$("#classroom").html('<option value="">请选择教室</option>');
			form.render('select');
			$.ajax({
				type: "POST",
				url: "/classes/get_classroom_by_campus/"+campus_id,
				dataType:"json",
				success: function(result){
					var html ='';
					$.each(result, function(i, obj) {
						html += '<option value="'+obj.id+'">'+obj.name+'</option>';
					});
					$("#classroom").append(html);
					form.render('select');
					layer.close(ii);
				}
			});
		});

	});
</script>

</body>
</html>
